package com.maduar.mybatis.demo.service;

import com.maduar.mybatis.demo.User;
import com.maduar.mybatis.demo.util.Result;
import feign.Param;
import feign.QueryMap;
import feign.RequestLine;
import org.springframework.cloud.openfeign.FeignClient;

import java.util.Map;

/**
 * Description:
 *
 * @author maduar maduar@163.com
 * @date 2021-05-12 17:31
 */
@FeignClient(contextId = "remoteClient", name = "maduar-demo", fallback = RemoteHystrix.class)
public interface RemoteClient {

    @RequestLine("GET /getUser?name=${name}&age=${age}")
    Result<User> getUser(@Param("name") String name,
                         @Param("age") int age);

    @RequestLine("GET /getYourAge")
    Result<Integer> getYourAge(@QueryMap Map<String, Object> queryMap);

    @RequestLine("GET /getAge")
    Result<Integer> getAge();

    @RequestLine("POST /addUser")
    Result<User> addUser(User user);

}
